package com.han.school.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.han.school.mapper.StuleaveMapper;
import com.han.school.pojo.Stuleave;
import com.han.school.service.StuLeaveService;
import com.han.school.vo.StuLeaveVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StuLeaveServiceImpl implements StuLeaveService {
    @Autowired
    private StuleaveMapper stuleaveMapper;

    @Override
    public PageInfo<Stuleave> selectAll(StuLeaveVo stuLeaveVo) {
        PageHelper.startPage(stuLeaveVo.getPage(),stuLeaveVo.getLimit());
        List<Stuleave> stuleaves = stuleaveMapper.selectAll();
        PageInfo<Stuleave> stuleavePageInfo = new PageInfo<>(stuleaves);
        return stuleavePageInfo;
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return 0;
    }

    @Override
    public int insert(Stuleave record) {
        int insert = stuleaveMapper.insert(record);
        return insert;
    }

    @Override
    public Stuleave selectByPrimaryKey(Integer id) {

        return null;
    }

    @Override
    public int updateByStuname(Stuleave record) {
        int i = stuleaveMapper.updateByStuname(record);
        return i;
    }
}
